﻿<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false" CodeBehind="addWorkOrder.aspx.cs"
    Inherits="WorkOrder.addWorkOrder" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../css/left.css" type="text/css" rel="STYLESHEET" />
    <link href="../css/site2.css" type="text/css" rel="STYLESHEET" />
    <script language="javascript" type="text/javascript">        //加在head中，PNG无灰色背景
        var tmp = window.navigator.userAgent.toLowerCase().indexOf("MSIE");
        //加在head中，PNG无灰色背景
        function correctPNG() {
            for (var i = 0; i < document.images.length; i++) {
                var img = document.images[i];
                var imgName = img.src.toUpperCase();
                if (imgName.substring(imgName.length - 3, imgName.length) == "PNG") {
                    var imgID = (img.id) ? "id='" + img.id + "' " : "";
                    var imgClass = (img.className) ? "class='" + img.className + "' " : "";
                    var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
                    var imgStyle = "display:inline-block;" + img.style.cssText;
                    if (img.align == "left") imgStyle = "float:left;" + imgStyle;
                    if (img.align == "right") imgStyle = "float:right;" + imgStyle;
                    if (tmp >= 1) {
                        if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
                    }
                    else {
                        if (img.parentNode.href) imgStyle = "cursor:hand;" + imgStyle;
                    }
                    var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
       + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
                    img.outerHTML = strNewHTML;

                }
            }
        }

        if (window.addEventListener) {
            window.addEventListener('DOMContentLoaded', correctPNG, false);   //firefox
            window.addEventListener('load', correctPNG, false);
        } else if (window.attachEvent) {
            window.attachEvent('onload', correctPNG);  //IE
        }
    </script>
    <script type="text/javascript" src="../DatePicker/WdatePicker.js" defer="defer"></script>
    <script type="text/javascript">
        String.prototype.trim = function () {
            // 用正则表达式将前后空格，用空字符串替代。
            return this.replace(/(^\s*)|(\s*$)/g, "");
        }

        function saveValidate() {
            //form1.action = "addWorkOrder.aspx?a=0";
            if (document.getElementById("txtOrderNo").value.trim() == "")
            { alert("请输入工单号！"); return; }
            if (document.getElementById("seleOrderType").value == "0")
            { alert("请选择业务类型！"); return; }
            if (document.getElementById("txtGroupcode").value.trim() == "")
            { alert("请输入集团编码！"); return; }
            if (document.getElementById("txtCustomerCode").value.trim() == "")
            { alert("请输入用户编码！"); return; }
            if (document.getElementById("ddlProduct").value == "0")
            { alert("请选择产品类型！"); return; }
            if (document.getElementById("seleArea").value == "0")
            { alert("请选择区域！"); return; }
            if (document.getElementById("seleTown").value == "0" && document.getElementById("seleArea").value != "7")
            { alert("请选择镇区！"); return; }
            else { document.getElementById("hidTown").value = document.getElementById("seleTown").value; }
            if ((document.getElementById("ddlProduct").value == "1" || document.getElementById("ddlProduct").value == "2") && document.getElementById("seleOrderType").value == "1" && document.getElementById("seleAccess").value.trim() == "0")
            { alert("请选择接入方式！"); return; }
            if (document.getElementById("rblIsBackTrue").checked) {
                if (document.getElementById("ddlReasonType").value == "0") { alert("请输入退单原因！"); return; }
            }
            document.getElementById("form1").submit();
        }
        function setCreateTime() {
            if (document.getElementById("txtOrderNo").value.trim() != "") {
                var tmpstr1 = document.getElementById("txtOrderNo").value.trim().substr(13, 4);
                var tmpstr2 = document.getElementById("txtOrderNo").value.trim().substr(17, 2);
                var tmpstr3 = document.getElementById("txtOrderNo").value.trim().substr(19, 2);
                document.getElementById("hidCreateTime").value = tmpstr1 + "-" + tmpstr2 + "-" + tmpstr3 + " 1:0:0";
            }
        }
        function setOrderType() {
            if (document.getElementById("txtOrderNo").value.trim() != "") {
                setCreateTime();
                var tmpstr = document.getElementById("txtOrderNo").value.trim().substr(8, 4);
                if (tmpstr == "YWKT") {
                    for (var i = 0; i < document.getElementById("seleOrderType").options.length; i++) {
                        if (document.getElementById("seleOrderType").options.item(i).text == "开通") {
                            document.getElementById("seleOrderType").selectedIndex = i;
                        }
                    }
                }
                else if (tmpstr == "YWTZ") {
                    for (var i = 0; i < document.getElementById("seleOrderType").options.length; i++) {
                        if (document.getElementById("seleOrderType").options.item(i).text == "调整") {
                            document.getElementById("seleOrderType").selectedIndex = i;
                        }
                    }
                }
                else if (tmpstr == "YWQX") {
                    for (var i = 0; i < document.getElementById("seleOrderType").options.length; i++) {
                        if (document.getElementById("seleOrderType").options.item(i).text == "取消") {
                            document.getElementById("seleOrderType").selectedIndex = i;
                        }
                    }
                }
            }
        }

        function setAreaAndProduct() {
            if (document.getElementById("txtTitle").value.trim() != "") {
                var product1 = document.getElementById("txtTitle").value.trim().substr(0, 4);
                var product2 = document.getElementById("txtTitle").value.trim().substr(0, 5);
                var a = document.getElementById("txtTitle").value.trim().replace("（", "(");
                a = a.replace("）", ")");
                var areastr = a.substr(a.indexOf("(") + 1, 2);
                for (var i = 0; i < document.getElementById("seleArea").options.length; i++) {
                    if (document.getElementById("seleArea").options.item(i).text == areastr) {
                        document.getElementById("seleArea").selectedIndex = i;
                        resetSelectByArray(document.getElementById("seleArea").value);
                    }
                }
                if (product1 == "语音专线") {
                    for (var i = 0; i < document.getElementById("ddlProduct").options.length; i++) {
                        if (document.getElementById("ddlProduct").options.item(i).text == "语音专线") {
                            document.getElementById("ddlProduct").selectedIndex = i;
                        }
                    }
                }
                else if (product1 == "数据专线") {
                    for (var i = 0; i < document.getElementById("ddlProduct").options.length; i++) {
                        if (document.getElementById("ddlProduct").options.item(i).text == "数据专线") {
                            document.getElementById("ddlProduct").selectedIndex = i;
                        }
                    }
                }
                else if (product2 == "企业信息机") {
                    for (var i = 0; i < document.getElementById("ddlProduct").options.length; i++) {
                        if (document.getElementById("ddlProduct").options.item(i).text == "企业信息机") {
                            document.getElementById("ddlProduct").selectedIndex = i;
                        }
                    }
                }
            }
        }
        var arrZhongqu = new Array(); //2
        arrZhongqu[0] = new Array('大岭山', '6');
        arrZhongqu[1] = new Array('大朗', '7');
        arrZhongqu[2] = new Array('黄江', '8');
        arrZhongqu[3] = new Array('常平', '9');
        arrZhongqu[4] = new Array('东坑', '28');

        var arrChengqu = new Array(); //1
        arrChengqu[0] = new Array('万江', '1');
        arrChengqu[1] = new Array('南城', '2');
        arrChengqu[2] = new Array('东城', '3');
        arrChengqu[3] = new Array('莞城', '4');
        arrChengqu[4] = new Array('松山湖', '5');

        var arrDongqu = new Array(); //3
        arrDongqu[0] = new Array('凤岗', '10');
        arrDongqu[1] = new Array('塘厦', '11');
        arrDongqu[2] = new Array('清溪', '12');
        arrDongqu[3] = new Array('谢岗', '13');
        arrDongqu[4] = new Array('樟木头', '14');
        arrDongqu[5] = new Array('桥头', '31');

        var arrNanqu = new Array(); //4
        arrNanqu[0] = new Array('虎门', '15');
        arrNanqu[1] = new Array('长安', '16');
        arrNanqu[2] = new Array('沙田', '23');

        var arrXiqu = new Array(); //5
        arrXiqu[0] = new Array('中堂', '17');
        arrXiqu[1] = new Array('望牛墩', '18');
        arrXiqu[2] = new Array('麻涌', '19');
        arrXiqu[3] = new Array('高埗', '20');
        arrXiqu[4] = new Array('道滘', '21');
        arrXiqu[5] = new Array('洪梅', '22');
        arrXiqu[6] = new Array('厚街', '24');

        var arrBeiqu = new Array(); //6
        arrBeiqu[0] = new Array('石碣', '25');
        arrBeiqu[1] = new Array('石龙', '26');
        arrBeiqu[2] = new Array('石排', '27');
        arrBeiqu[3] = new Array('寮步', '29');
        arrBeiqu[4] = new Array('横沥', '30');
        arrBeiqu[5] = new Array('茶山', '32');
        arrBeiqu[6] = new Array('企石', '33');

        function resetSelectByArray(sValue) {
            var selectValue = sValue;
            var Obj = document.getElementById("seleTown");
            var arrLen = 0;
            var i = 0;
            var optText;
            var optValue;
            if (selectValue == "1") {
                arrLen = arrChengqu.length;
                Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
                for (i = 0; i < arrLen; i++) {
                    optText = arrChengqu[i][0];
                    optValue = arrChengqu[i][1];
                    Obj.options.add(new Option(optText, optValue));
                }
            }
            else if (selectValue == "2") {
                arrLen = arrZhongqu.length; Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
                for (i = 0; i < arrLen; i++) {
                    optText = arrZhongqu[i][0];
                    optValue = arrZhongqu[i][1];
                    Obj.options.add(new Option(optText, optValue));
                }
            }
            else if (selectValue == "3") {
                arrLen = arrDongqu.length; Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
                for (i = 0; i < arrLen; i++) {
                    optText = arrDongqu[i][0];
                    optValue = arrDongqu[i][1];
                    Obj.options.add(new Option(optText, optValue));
                }
            }
            else if (selectValue == "4") {
                arrLen = arrNanqu.length; Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
                for (i = 0; i < arrLen; i++) {
                    optText = arrNanqu[i][0];
                    optValue = arrNanqu[i][1];
                    Obj.options.add(new Option(optText, optValue));
                }
            }
            else if (selectValue == "5") {
                arrLen = arrXiqu.length; Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
                for (i = 0; i < arrLen; i++) {
                    optText = arrXiqu[i][0];
                    optValue = arrXiqu[i][1];
                    Obj.options.add(new Option(optText, optValue));
                }
            }
            else if (selectValue == "6") {
                arrLen = arrBeiqu.length; Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
                for (i = 0; i < arrLen; i++) {
                    optText = arrBeiqu[i][0];
                    optValue = arrBeiqu[i][1];
                    Obj.options.add(new Option(optText, optValue));
                }
            }
            else if (selectValue == "7") {
                Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
                Obj.options.add(new Option('集客', '34'));
            }
            else if (selectValue == "8") {
                Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
                Obj.options.add(new Option('内部客户', '35'));
            }
            else {
                Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
            }

        }

        function showReason1() {
            document.getElementById("reason1").style.display = "block";
            document.getElementById("reason2").style.display = "block";
            document.getElementById("reason3").style.display = "block";
            document.getElementById("reason4").style.display = "block";
        }

        function showReason2() {
            document.getElementById("reason1").style.display = "none";
            document.getElementById("reason2").style.display = "none";
            document.getElementById("reason3").style.display = "none";
            document.getElementById("reason4").style.display = "none";
        }

    </script>
</head>
<body style="margin: 0 0 0 0; background-color: #fff; border-left: solid 1px #54a6e2;">
    <form id="form1" runat="server">
    <div>
        <table style="width: 100%">
            <tr>
                <td>
                    <div style="border: solid 1px #9fd6ff; background-color: #d4f1f9; border-bottom: none;">
                        <table style="width: 100%">
                            <tr>
                                <td style="height: 20px;">
                                    &nbsp;&nbsp;<img alt="" align="absmiddle" src="../images/181.gif" />&nbsp; <strong>修改工单信息</strong>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div style="border: solid 1px #9fd6ff; background-color: #f0f8ff;">
                        <table style="width: 100%">
                            <tr>
                                <td style="width: 10px;">
                                </td>
                                <td>
                                    <table border="0" style="width: 820px">
                                        <tr>
                                            <td align="left">
                                                工单号：
                                            </td>
                                            <td align="left" style="width: 230px; height: 24px;">
                                                <input id="txtOrderNo" type="text" runat="server" class="TextBox" onblur="setOrderType()"
                                                    style="width: 195px" />
                                            </td>
                                            <td align="left" style="width: 160px;">
                                                集团编码：
                                            </td>
                                            <td align="left" style="height: 24px;">
                                                <asp:TextBox ID="txtGroupcode" runat="server" CssClass="TextBox" Width="160px" MaxLength="40"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">
                                                工单主题：
                                            </td>
                                            <td align="left">
                                                <input id="txtTitle" type="text" runat="server" class="TextBox" onblur="setAreaAndProduct()"
                                                    style="width: 195px" />
                                            </td>
                                            <td>
                                                用户编码：
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtCustomerCode" runat="server" CssClass="TextBox" Width="160px"
                                                    MaxLength="40"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">
                                                业务类型：
                                            </td>
                                            <td align="left">
                                                <asp:DropDownList ID="ddlProduct" runat="server" CssClass="TextBox" Width="100px">
                                                </asp:DropDownList>
                                                <select id="seleOrderType" runat="server" style="width: 100px;" class="TextBox" name="D1">
                                                    <option value="0">-- 请选择 --</option>
                                                    <option value="1">开通</option>
                                                    <option value="2">取消</option>
                                                    <option value="3">调整</option>
                                                </select>
                                            </td>
                                            <td align="left">
                                                区域：
                                            </td>
                                            <td align="left">
                                                <select id="seleArea" runat="server" style="width: 80px;" class="TextBox" onblur="resetSelectByArray(this.value);"
                                                    onchange="resetSelectByArray(this.value);" name="D2">
                                                    <option value="0" selected="selected">--请选择--</option>
                                                    <option value="1">城区</option>
                                                    <option value="2">中区</option>
                                                    <option value="3">东区</option>
                                                    <option value="4">南区</option>
                                                    <option value="5">西区</option>
                                                    <option value="6">北区</option>
                                                    <option value="7">集客</option>
                                                    <option value="8">内部客户</option>
                                                </select><select id="seleTown" runat="server" style="width: 80px;" class="TextBox"
                                                    name="seleTown">
                                                </select><input type="hidden" id="hidTown" runat="server" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">
                                                工单内容：
                                            </td>
                                            <td align="left" colspan="3">
                                                <asp:TextBox ID="txtOrderContent" runat="server" CssClass="TextBox" Width="550px"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">
                                                接入方式：
                                            </td>
                                            <td align="left">
                                                <select id="seleAccess" name="seleAccess" runat="server" style="width: 200px;" class="TextBox">
                                                    <option value="0">-- 请选择 --</option>
                                                    <option value="传统方式接入">传统方式接入</option>
                                                    <option value="GPON接入">GPON接入</option>
                                                    <option value="无线接入">无线接入</option>
                                                </select>
                                                
                                            </td>
                                            <td align="left">
                                                派单时间：
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="txtPtime" runat="server" CssClass="TextBox" Width="160px"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">
                                                需求分析和资源预占：
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="txtAnalysis_time" runat="server" CssClass="TextBox" Width="195px"></asp:TextBox>
                                            </td>
                                            <td align="left">
                                                CRM资源预占确认：
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="txtConfirm_time" runat="server" CssClass="TextBox" Width="160px"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">
                                                审核方案：
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="txtAudit_time" runat="server" CssClass="TextBox" Width="195px"></asp:TextBox>
                                            </td>
                                            <td align="left">
                                                数据和资源配置：
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="txtConfig_time" runat="server" CssClass="TextBox" Width="160px"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">
                                                完成时间（实施业务测试）：
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="txtFinish" runat="server" CssClass="TextBox" Width="195px"></asp:TextBox>
                                            </td>
                                            <td align="left">
                                                所属聚类客户：</td>
                                            <td align="left">
                                                <asp:TextBox ID="txtClustering_client" runat="server" CssClass="TextBox" 
                                                    Width="160px"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">
                                                备注：
                                            </td>
                                            <td align="left" colspan="3">
                                                <asp:TextBox ID="txtRemark" runat="server" CssClass="TextBox" Width="550px"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                是否退单：
                                            </td>
                                            <td>
                                                <input id="rblIsBackTrue" type="radio" name="rblIsBack" value="1" runat="server"
                                                    onclick="showReason1()" />是 &nbsp;&nbsp;&nbsp;&nbsp;
                                                <input id="rblIsBackFalse" type="radio" name="rblIsBack" value="0" runat="server"
                                                    onclick="showReason2()" />否
                                            </td>
                                            <td>
                                                <div id="reason1" style="display: none;">
                                                    退单原因：</div>
                                            </td>
                                            <td>
                                                <div id="reason2" style="display: none;">
                                                    <asp:DropDownList ID="ddlReasonType" runat="server" CssClass="TextBox" Width="160px">
                                                    </asp:DropDownList>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <div id="reason3" style="display: none;">
                                                    退单描述：</div>
                                            </td>
                                            <td colspan="3">
                                                <div id="reason4" style="display: none;">
                                                    <asp:TextBox ID="txtReasonComment" runat="server" CssClass="TextBox" Width="617px"></asp:TextBox></div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">
                                            </td>
                                            <td align="left">
                                            </td>
                                            <td align="left">
                                            </td>
                                            <td align="left">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">
                                            </td>
                                            <td align="left">
                                                <input id="btnSave" type="button" value="&nbsp;保&nbsp;&nbsp;&nbsp;&nbsp;存&nbsp;"
                                                    class="Button" onclick="saveValidate();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input
                                                        id="Reset1" type="reset" value="&nbsp;重&nbsp;&nbsp;&nbsp;&nbsp;置&nbsp;" class="Button" />
                                            </td>
                                            <td align="left" colspan="2">
                                                <asp:Label ID="lblMsg" runat="server" Font-Size="12px"></asp:Label>
                                                <input type="hidden" id="hidCreateTime" runat="server" value="" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">
                                                &nbsp;
                                            </td>
                                            <td align="left">
                                                &nbsp;
                                            </td>
                                            <td align="left">
                                            </td>
                                            <td align="left">
                                                &nbsp;
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
